<?php
	include_once "common.php"; //MUST ALWAYS BE THE LAST INCLUDE
	//----------------------------------------------------------------------

	function file_save($obj){
		$base_path = "./temp/";
		
		$filename = $base_path."project.csv";
		
		if (file_exists($base_path) == false)
			exit_with_response(-1, "Could not locate base-path: ".$base_path);
		
		if (file_put_contents($filename, $obj->data->file_content) === false){
			exit_with_response(-1, "Failed to create file");
		}
		
		$result["filename"] = "./boiler_plate/".$filename;
		exit_with_response(0, "", json_encode($result));
	}
	
?>
